#include "yuvfilespec.h"

void YUVFileSpec::copyFilePath(char *filePath)
{

    int len = 0;

    if(filePath != nullptr){

        len = strlen(filePath);
    }

    if(len > 0) {

        _filePath = new char[len+1]{};
        memcpy(_filePath,filePath,len);
    }

}

YUVFileSpec::YUVFileSpec():
    YUVFileSpec(0,0,0,AV_PIX_FMT_NONE, nullptr)
{


}

YUVFileSpec::YUVFileSpec(int width, int height, int fps, AVPixelFormat format, char *filePath):
    YUVSpec(width, height, fps, format)
{

    copyFilePath(filePath);
}

YUVFileSpec::~YUVFileSpec()
{

    if(_filePath != nullptr) {

        delete [] _filePath;
        _filePath = nullptr;
    }
}

char *YUVFileSpec::getFilePath()
{

    return _filePath;
}

